package com.cj.order.controller;

import com.cj.common.response.Result;
import com.cj.order.entity.Order;
import com.cj.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author cheng jun
 * @Description:
 * @Date 2021/7/25 15:27
 */
@Controller
@RequestMapping(value = "/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @RequestMapping(value = "/placeOrder", method = RequestMethod.POST)
    @ResponseBody
    public Result placeOrder(@RequestBody Order order) {
        return Result.success(orderService.placeOrder(order));
    }

    @RequestMapping(value = "/pay", method = RequestMethod.POST)
    @ResponseBody
    public Result pay(@RequestBody Order order) {
        return Result.success(orderService.pay(order));
    }
}
